@echo off
REM Simple build script for Windows
REM This script assumes you have RISC-V toolchain and make installed

echo Building RISC-V minimal OS...

REM Check if make is available
where make >nul 2>nul
if %errorlevel% neq 0 (
    echo Error: make is not installed or not in PATH
    echo Please install make or add it to your PATH
    pause
    exit /b 1
)

REM Check if RISC-V GCC is available
where riscv64-unknown-elf-gcc >nul 2>nul
if %errorlevel% neq 0 (
    echo Error: riscv64-unknown-elf-gcc is not installed or not in PATH
    echo Please install RISC-V toolchain
    pause
    exit /b 1
)

REM Clean previous build
echo Cleaning previous build...
make clean

REM Build the kernel
echo Building kernel...
make

if %errorlevel% equ 0 (
    echo Build successful!
    echo.
    echo To run in QEMU, use: make run
    echo To debug, use: make debug
) else (
    echo Build failed!
)

pause
